package cn.yiueil;

import java.util.ArrayList;
import java.util.List;

public class BookShelf implements IterateAble {
    private final List<Book> bookList = new ArrayList<>();

    @Override
    public void add(Book book) {
        bookList.add(book);
    }

    @Override
    public Iterator<Book> getIterator() {
        return new BookShelfIterator(this);
    }

    @Override
    public Book get(int index) {
        return bookList.get(index);
    }

    @Override
    public void del(Book book) {
        bookList.remove(book);
    }

    @Override
    public int getLength() {
        return bookList.size();
    }
}
